<template>
  <el-form :model="fromData" :rules="fromData_rules" :disabled="readonly" ref="fromDataRef" label-width="100px">
    <el-form-item label="名字" prop="name">
      <el-input v-model="fromData.name"></el-input>
    </el-form-item>
    <el-form-item label="创建时间" prop="createDate">
      <!-- <el-input v-model="fromData.createDate"></el-input> -->
      <el-date-picker class="w100" value-format="yyyy-MM-dd HH:mm:ss" v-model="fromData.createDate" type="datetime" placeholder="选择日期时间">
      </el-date-picker>
    </el-form-item>
    <el-form-item label="创建者" prop="creator">
      <el-input v-model="fromData.creator"></el-input>
    </el-form-item>
    <el-form-item label="状态" prop="state">
      <el-select class="w100" v-model="fromData.state" placeholder="">
        <el-option v-for="item in stateOptions" :key="item.value" :label="item.name" :value="item.value">
        </el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="类型" prop="type">
      <el-select class="w100" v-model="fromData.type" placeholder="请选择类型">
        <el-option v-for="item in typeOptions" :key="item.value" :label="item.name" :value="item.value">
        </el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="h" prop="h">
      <el-input v-model="fromData.h"></el-input>
    </el-form-item>
    <el-form-item label="x" prop="x">
      <el-input v-model="fromData.x"></el-input>
    </el-form-item>
    <el-form-item label="y" prop="y">
      <el-input v-model="fromData.y"></el-input>
    </el-form-item>
    <el-form-item label="备注" prop="remark">
      <el-input type="textarea" v-model="fromData.remark"></el-input>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  props: {
    fromData: {},
    set: {
      type: Boolean,
      default: false
    },
    readonly: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      fromData_rules: {
        name: [{ required: true, message: '请输入名称', trigger: 'blur' }]
      },
      stateOptions: [
        { name: '正常', value: 0 },
        { name: '禁用', value: 1 }
      ],
      typeOptions: [
        { name: '基准点', value: 1 },
        { name: '工作基点', value: 2 }
      ]
    }
  },
  methods: {
    validate() {
      let res_bool = false
      this.$refs.fromDataRef.validate(bool => {
        res_bool = bool
      })
      return res_bool
    },
    resetFields() {
      this.$refs.fromDataRef.resetFields()
    }
  }
}
</script>

<style>
</style>